package com.oa.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gson.Gson;
import com.oa.bean.UserInfo;
import com.oa.biz.impl.UserInfosServiceImpl;
import com.oa.pojo.UserInfos;

@WebServlet("/userinfos")
public class UserInfosServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		
		String id=request.getParameter("id");
    	UserInfos us=new UserInfosServiceImpl().getInfo(id);
    	
    	System.out.println("左上角的用户名==>"+us.getUserName());    		
    	response.getWriter().write(new Gson().toJson(us));    
	}


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
